@extends('layouts.default')
@section('content')
@include('modules.thanhmenu')
<table width="100%" cellspacing="5" cellpadding="5">
    <tr>
        <td width="10%">MSSV</td>
        <td width="20%">Họ tên</td>
        <td width="40%">Đề tài thực hiện</td>
        <td width="15%">Trạng thái</td>
        <td width="15%">Tác vụ</td>	
    </tr>
    <?php
    $CanBoQLDeTaiVaSVDK = new CanBoQLDeTaiVaSVDK();

    $HomeController = new HomeController();
    $nienkhoahientai = $HomeController->shownienkhoahockyhientai()->nien_khoa;
    $hockyhientai = $HomeController->shownienkhoahockyhientai()->hoc_ky;

    $dssinhvien = $CanBoQLDeTaiVaSVDK->show_svdk1(Session::get('infor.id_nd')[0], $nienkhoahientai, $hockyhientai);

    $CanBoDGVaDBL = new CanBoDGVaDBL();

    if (Session::has('ketqua')) {
        if (Session::has('ketqua') == 1) {
            echo "<script>alert('Duyệt thành công')</script>";
        } else {
            echo "<script>alert('Duyệt thất bại')</script>";
        }
    }

    foreach ($dssinhvien as $key1) {
        echo "<form method='post' action='" . URL . "cb/4/bl/duyetbl'>";
        $idsinhvien = $key1->idsinhvien;
        echo "<tr>";
        echo "<td>";
        echo $key1->mssv;
        echo "</td>";
        echo "<td>";
        echo $key1->ho . " " . $key1->ten;
        echo "</td>";
        echo "<td>";
        echo $key1->ten_de_tai;
        echo "</td>";
        echo "<td>";
        $dsdiemsv = $CanBoDGVaDBL->lay_danh_gia_sinh_vien($key1->mssv);
        if (isset($dsdiemsv)) {
            $diemsv = $dsdiemsv->diem_chu;
            if ($diemsv == "I") {
                echo "Bảo lưu";
            } else {
                echo "Đang thực hiện";
            }
        } else {
            echo "Đang thực hiện";
        }
        echo "</td>";

        $dsidchitiethuongdan = $CanBoDGVaDBL->lay_id_chi_tiet_huong_dan($key1->iddetai, Session::get('infor.id_nd')[0]);
        $idchitiethuongdan = $dsidchitiethuongdan->id;
        echo "<td>";
        echo "<input type='submit' value='Duyệt' name='btnDuyet'>";
        echo "<input style='display: none;' type='number' value='" . $idchitiethuongdan . "' name='txtIDChiTietHuongDan'>";
        echo "<input style='display: none;' type='number' value='" . $idsinhvien . "' name='txtIDSinhVien'>";
        echo "</td>";
        echo "</tr>";
        echo "</form>";
    }
    ?>
</table>
@stop

